﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ThanhTu.GNCMedia.KQXS.DataAccess.DAL;
using ThanhTu.GNCMedia.KQXS.DataAccess.DO;

namespace ThanhTu.GNCMedia.KQXS.DataAccess.BL
{
    public class UsersBL : IDisposable
    {
        private UsersDAL vUsersDAL = null;
        private bool disposed = false;
        public UsersBL()
        {
            if (vUsersDAL == null)
            {
                vUsersDAL = new UsersDAL();
            }
        }
        ~UsersBL() { Dispose(false); }

        #region IDisposable Members

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    if (vUsersDAL != null)
                    {
                        vUsersDAL.Dispose();
                        vUsersDAL = null;
                    }
                }

                disposed = true;
            }
        }

        #endregion

        public int login(string username, string password) { return vUsersDAL.login(username, password); }
        public List<UsersDO> SelectAllUsers() { return vUsersDAL.SelectAllUsers(); }
        public UsersDO GetByUser(string username, string password) { return vUsersDAL.GetByUser(username, password); }
        public int Add(UsersDO vUsersDO) { return vUsersDAL.Add(vUsersDO); }
    }
}
